//
//  DLUploadImageTool.h
//  DLKJ
//
//  Created by wangsh on 2018/1/23.
//  Copyright © 2018年 李宇廷. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Qiniu/QiniuSDK.h>
#import <UIKit/UIKit.h>


@interface DLUploadImageTool : NSObject

@property (copy, nonatomic) void (^singleSuccessBlock)(NSString *);
@property (copy, nonatomic) void (^singleFailureBlock)(NSError *);

/**
 请求成功的block
 
 @param responseObject 响应体数据
 */
typedef void(^DLUploadSuccess)(id responseObject);
/**
 请求失败的block
 
 @param error 扩展信息
 */
typedef void(^DLUploadFailure)(NSError *error);



+ (instancetype)sharedUploadHelper;



/**
 获取七牛上传token

 @param success success description
 @param failure failure description
 */
+ (void)getQiniuUploadToken:(void (^)(NSString *token,NSString *key,NSString *upload_name))success failure:(DLUploadFailure)failure;
/**
 *  上传图片
 *
 *  @param image    需要上传的image
 *  @param progress 上传进度block
 *  @param success  成功block 返回url地址
 *  @param failure  失败block
 */
+ (void)uploadImage:(UIImage *)image progress:(QNUpProgressHandler)progress success:(DLUploadSuccess)success failure:(DLUploadFailure)failure;


/**
 上传多张图片,按队列依次上传

 @param imageArray 图片数组
 @param progress 进度
 @param success success description
 @param failure failure description
 */
+ (void)uploadImages:(NSArray *)imageArray progress:(void (^)(CGFloat percent))progress success:(DLUploadSuccess)success failure:(DLUploadFailure)failure;


/**
 视频上传

 @param data 二进制数据
 @param progress 进度
 @param success success description
 @param failure failure description
 */
+ (void)uploadData:(NSData *)data progress:(QNUpProgressHandler)progress success:(DLUploadSuccess)success failure:(DLUploadFailure)failure;


/**
 路径上传

 @param file 文件名
 @param progress 进度
 @param complete complete description
 */
+ (void)uploadFile:(NSString *)file progress:(QNUpProgressHandler)progress complete:(void (^)(QNResponseInfo *info, NSString *key, NSDictionary *resp))complete;
@end
